<template>
  <div>
    <el-input
        v-model="kwd"
        placeholder="如：'毛肚'或'md'"
        size="small"
        style="float: right;width:200px; padding: 3px 0"
        @change="search">
      <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
    </el-input>
  </div>
</template>

<script>
export default {
  props: ['keyword', 'products'],
  data() {
    return {
      kwd: this.keyword,
      prds: this.products,
    }
  },
  methods: {
    async search() {
      if (this.kwd) {
        this.prds = await this.axios.post(`admin/product/search`, {keyword: this.kwd})
        await this.$emit('update', this.prds)
      }
    }
  }
}
</script>

<style scoped>

</style>